package com.dyp.globalexceptionhandler.ctr;

import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDateEditor extends PropertyEditorSupport {
    @Override
    public void setValue(Object value) {
        super.setValue(value);
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        Date d=null;
        try {
            System.out.println("我调用自己的全局MVC属性编辑器");
            d=new SimpleDateFormat("MM-dd-yyyy").parse(text);
            setValue(d);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}